#include<stdio.h>
struct ListNode* removeElements(struct ListNode* head, int val)
{
while(head!=NULL&&head->val==val)
{
    head=head->next;
}
struct ListNode*begin=head;
while(begin!=NULL)
{
    while(begin->next!=NULL&&begin->next->val==val)
    {
        begin->next=begin->next->next;
    }
    begin=begin->next;
}
return head;
}